home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Framework / Includes / UAdorners.h < prev    next >
Encoding:
Text File  |  1996-04-03  |  28.4 KB  |  889 lines  |  [TEXT/MPS ]

  1. // UAdorners.h
  2. // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. #ifndef __UADORNERS__
  5. #define __UADORNERS__
  6.  
  7. // MacApp
  8.  
  9. #ifndef __TOOLBOX__
  10. #include "Toolbox.h"
  11. #endif
  12.  
  13. #ifndef __UDYNAMICARRAY__
  14. #include "UDynamicArray.h"
  15. #endif
  16.  
  17. #ifndef __UGEOMETRY__
  18. #include "UGeometry.h"
  19. #endif
  20.  
  21. #ifndef __ULISTITERATOR__
  22. #include "UListIterator.h"
  23. #endif
  24.  
  25.  
  26. //----------------------------------------------------------------------------------------
  27. // Forward and external class declarations. 
  28. //----------------------------------------------------------------------------------------
  29.  
  30. class TAdorner;
  31. class TAdornerList;
  32. class TView;
  33.  
  34.  
  35. //----------------------------------------------------------------------------------------
  36. // Constants used to indicate adorner priorities
  37. //----------------------------------------------------------------------------------------
  38.  
  39. const short kAdornLast = 127;
  40.     // Low priority adorners are considered last
  41.  
  42. const short kAdornAfter = kAdornLast - 32;
  43.     // Low priority adorners are considered last
  44.  
  45. const short kDrawView = 64;
  46.     // View priority is special case
  47.  
  48. const short kAdornBefore = kDrawView - 32;
  49.     // High priority adorners take precedence
  50.  
  51. const short kAdornFirst = 0;
  52.     // High priority adorners take precedence
  53.  
  54.  
  55. //----------------------------------------------------------------------------------------
  56. // Constants for indicating whether an adorner should be freed.  TAdorner::RemovedFromView
  57. // tests fFreeOnDeletion to see if the object should free itself.
  58. //----------------------------------------------------------------------------------------
  59.  
  60. const Boolean kFreeOnDeletion = TRUE;
  61.  
  62. const Boolean kDontFreeOnDeletion = !kFreeOnDeletion;
  63.  
  64.  
  65. //----------------------------------------------------------------------------------------
  66. // Constant signatures for some default adorners.
  67. //----------------------------------------------------------------------------------------
  68.  
  69. const IDType kDimAdorner        = 'dima';
  70. const IDType kDrawAdorner        = 'draw';
  71. const IDType kEraseAdorner        = 'eras';
  72. const IDType kFrameAdorner        = 'fram';
  73. const IDType kHiliteAdorner        = 'hili';
  74. const IDType kLineBottomAdorner = 'lnbo';
  75. const IDType kLineLeftAdorner    = 'lnlf';
  76. const IDType kLineRightAdorner    = 'lnrt';
  77. const IDType kLineTopAdorner    = 'lntp';
  78. const IDType kOvalAdorner        = 'oval';
  79. const IDType kPrintAdorner        = 'prnt';
  80. const IDType kResizeIconAdorner = 'resz';
  81. const IDType kRRectAdorner        = 'rrct';
  82. const IDType kSelectionAdorner    = 'sele';
  83. const IDType kShadowedFrameAdorner    = 'sfra';
  84. const IDType kCompatibilityAdorner    = 'comp';
  85.  
  86.  
  87. //----------------------------------------------------------------------------------------
  88. // Typedefs
  89. //----------------------------------------------------------------------------------------
  90.  
  91. typedef char AdornPriority;
  92.  
  93.  
  94. //----------------------------------------------------------------------------------------
  95. // CAdornerIterator
  96. //----------------------------------------------------------------------------------------
  97.  
  98. class CAdornerIterator : public CArrayIterator
  99. {
  100. public:
  101.     CAdornerIterator(const TView* theView,
  102.                        ArrayIndex itsLowBound, ArrayIndex itsHighBound,
  103.                        Boolean itsForward);
  104.  
  105.     CAdornerIterator(const TView* theView, Boolean itsForward);
  106.  
  107.     CAdornerIterator(const TView* theView);
  108.  
  109.     CAdornerIterator(TAdornerList* theAdornerList);
  110.     
  111.     virtual ~CAdornerIterator();
  112.     
  113.     TAdorner* CurrentAdorner();
  114.         // returns the current adorner
  115.     
  116.     TAdorner* FirstAdorner();
  117.         // Reset the iteration and return the first adorner in the iteration
  118.  
  119.     TAdorner* NextAdorner();
  120.         // advances the iteration and then returns the adorner
  121. };
  122.  
  123.  
  124. //----------------------------------------------------------------------------------------
  125. // TAdorner: abstract superclass for adorners which are basically  rendering algorithms  
  126. //----------------------------------------------------------------------------------------
  127.  
  128. class TAdorner : public TObject
  129. {
  130.     MA_DECLARE_CLASS;
  131.     
  132. public:
  133.     //------------------------------------------------------------------------------------
  134.     // constructor and destructor
  135.     //------------------------------------------------------------------------------------
  136.  
  137.     TAdorner();
  138.  
  139.     virtual ~TAdorner();
  140.         // Destructor
  141.  
  142.     void IAdorner(IDType itsID, Boolean freeOnDeletion);
  143.         // initializes the adorner 
  144.  
  145.     //------------------------------------------------------------------------------------
  146.     // notification
  147.     //------------------------------------------------------------------------------------
  148.  
  149.     virtual void AddedToView(TView* itsView);
  150.         // Notification that this adorner has been added to a view
  151.  
  152.     virtual void RemovedFromView(TView* itsView);
  153.         // Notification that this adorner has been removed from a view
  154.  
  155.  
  156.     //------------------------------------------------------------------------------------
  157.     // Stream I/O protocol support.
  158.     //------------------------------------------------------------------------------------
  159.  
  160.     virtual void ReadFrom(TStream* aStream);    // Override
  161.     
  162.     virtual void WriteTo(TStream* aStream);    // Override
  163.  
  164.  
  165.     //------------------------------------------------------------------------------------
  166.     // rendering
  167.     //------------------------------------------------------------------------------------
  168.  
  169.     virtual void Draw(TView* itsView, const VRect& area);
  170.  
  171.     virtual void DrawLine(VHSelect vhs, short lh, short lv, short lto);
  172.         // Utility routine for adorners - draws a line. 
  173.  
  174.     virtual void DoHighlightSelection(TView* itsView, 
  175.                                              const VRect& area,
  176.                                              HLState fromHL,
  177.                                              HLState toHL);
  178.         // Adorns the selection before the view's DoHighlightSelection. 
  179.  
  180.     virtual void InvalidateAdorner(TView* itsView);
  181.         // Invalidates the adorner in itsView. 
  182.  
  183.     virtual void ViewChangedFrame (TView* itsView,
  184.                                             const VRect& oldFrame,
  185.                                             const VRect& newFrame,
  186.                                             Boolean    invalidate);
  187.         // This method is called when the owning view changes size 
  188.         
  189.     virtual Boolean DoesAdorn (TView* itsView);
  190.         // Default returns true. The adornment only includes enabled adorners
  191.         // in its iteration.
  192.  
  193.     //------------------------------------------------------------------------------------
  194.     // data members
  195.     //------------------------------------------------------------------------------------
  196. public:
  197.     IDType fIdentifier;                                    // The ID of this adorner, to distinguish
  198.                                                 // it from other instances.
  199.  
  200.     Boolean fFreeOnDeletion;                    // Should the adorner be freed when
  201.                                                 // removed from an adornment
  202. };
  203.  
  204.  
  205. //----------------------------------------------------------------------------------------
  206. // TCompatibilityAdorner: Draws the adornment available in MacApp 2.0.
  207. //----------------------------------------------------------------------------------------
  208.  
  209. class TCompatibilityAdorner : public TAdorner
  210. {
  211.     MA_DECLARE_CLASS;
  212.     
  213. public:
  214.     TCompatibilityAdorner();
  215.  
  216.     virtual ~TCompatibilityAdorner();
  217.         // Destructor
  218.  
  219.     void ICompatibilityAdorner(CntlAdornment itsAdornment);
  220.  
  221.     //------------------------------------------------------------------------------------
  222.     // Standard signature support.
  223.     //------------------------------------------------------------------------------------
  224.  
  225.     virtual IDType GetStandardSignature();    // Override 
  226.         // Returns this class's standard signature.
  227.  
  228.     //------------------------------------------------------------------------------------
  229.     // Stream I/O protocol support.
  230.     //------------------------------------------------------------------------------------
  231.  
  232.     virtual void ReadFrom(TStream* aStream);    // Override
  233.     
  234.     virtual void WriteTo(TStream* aStream);    // Override
  235.  
  236.     //------------------------------------------------------------------------------------
  237.     // rendering
  238.     //------------------------------------------------------------------------------------
  239.  
  240.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  241.  
  242.     //------------------------------------------------------------------------------------
  243.     // data members
  244.     //------------------------------------------------------------------------------------
  245. public:
  246.     CntlAdornment fAdornment;    
  247. };
  248.  
  249. //----------------------------------------------------------------------------------------
  250. // TDimAdorner
  251. //----------------------------------------------------------------------------------------
  252.  
  253. class TDimAdorner : public TAdorner
  254. {
  255.     MA_DECLARE_CLASS;
  256.     
  257. public:
  258.     TDimAdorner();
  259.     virtual ~TDimAdorner();
  260.         // Destructor
  261.  
  262.     inline void IDimAdorner()
  263.     { IAdorner(kDimAdorner,kDontFreeOnDeletion); }
  264.         // Initializes this adorner with ID kDimAdorner and fFreeOnDeletion false
  265.  
  266.     //------------------------------------------------------------------------------------
  267.     // Standard signature support.
  268.     //------------------------------------------------------------------------------------
  269.  
  270.     virtual IDType GetStandardSignature();    // Override 
  271.         // Returns this class's standard signature.
  272.  
  273.     //------------------------------------------------------------------------------------
  274.     // rendering
  275.     //------------------------------------------------------------------------------------
  276.  
  277.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  278.         // calls itsView->Dim
  279. };
  280.  
  281.  
  282. //----------------------------------------------------------------------------------------
  283. // TDrawAdorner
  284. //----------------------------------------------------------------------------------------
  285.  
  286. class TDrawAdorner : public TAdorner
  287. {
  288.     MA_DECLARE_CLASS;
  289.     
  290. public:
  291.     TDrawAdorner();
  292.     virtual ~TDrawAdorner();
  293.         // Destructor
  294.  
  295.     inline void IDrawAdorner()
  296.     { IAdorner(kDrawAdorner,kDontFreeOnDeletion); }
  297.         // Initializes this adorner with ID kDrawAdorner and fFreeOnDeletion false
  298.  
  299.     //------------------------------------------------------------------------------------
  300.     // Standard signature support.
  301.     //------------------------------------------------------------------------------------
  302.  
  303.     virtual IDType GetStandardSignature();    // Override 
  304.         // Returns this class's standard signature.
  305.  
  306.     //------------------------------------------------------------------------------------
  307.     // rendering
  308.     //------------------------------------------------------------------------------------
  309.  
  310.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  311.         // calls itsView->Draw(area)
  312. };
  313.  
  314.  
  315. //----------------------------------------------------------------------------------------
  316. // TEraseAdorner
  317. //----------------------------------------------------------------------------------------
  318.  
  319. class TEraseAdorner : public TAdorner
  320. {
  321.     MA_DECLARE_CLASS;
  322.     
  323. public:
  324.     TEraseAdorner();
  325.     virtual ~TEraseAdorner();
  326.         // Destructor
  327.  
  328.     inline void IEraseAdorner()
  329.     { IAdorner(kEraseAdorner,kDontFreeOnDeletion); }
  330.         // Initializes this adorner with ID kEraseAdorner and fFreeOnDeletion false
  331.  
  332.     //------------------------------------------------------------------------------------
  333.     // Standard signature support.
  334.     //------------------------------------------------------------------------------------
  335.  
  336.     virtual IDType GetStandardSignature();    // Override 
  337.         // Returns this class's standard signature.
  338.  
  339.     //------------------------------------------------------------------------------------
  340.     // rendering
  341.     //------------------------------------------------------------------------------------
  342.  
  343.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  344.         // calls itsView->Draw(area)
  345. };
  346.  
  347.  
  348. //----------------------------------------------------------------------------------------
  349. // THiliteAdorner
  350. //----------------------------------------------------------------------------------------
  351.  
  352. class THiliteAdorner : public TAdorner
  353. {
  354.     MA_DECLARE_CLASS;
  355.     
  356. public:
  357.     THiliteAdorner();
  358.     virtual ~THiliteAdorner();
  359.         // Destructor
  360.  
  361.     inline void IHiliteAdorner()
  362.     { IAdorner(kHiliteAdorner,kDontFreeOnDeletion); }
  363.         //  Initializes this adorner with ID kHiliteAdorner and fFreeOnDeletion false  
  364.  
  365.     //------------------------------------------------------------------------------------
  366.     // Standard signature support.
  367.     //------------------------------------------------------------------------------------
  368.  
  369.     virtual IDType GetStandardSignature();    // Override 
  370.         // Returns this class's standard signature.
  371.  
  372.     //------------------------------------------------------------------------------------
  373.     // rendering
  374.     //------------------------------------------------------------------------------------
  375.  
  376.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  377.         //  calls itsView->Hilite  
  378. };
  379.  
  380.  
  381. //----------------------------------------------------------------------------------------
  382. // TPrintAdorner
  383. //----------------------------------------------------------------------------------------
  384.  
  385. class TPrintAdorner : public TAdorner
  386. {
  387.     MA_DECLARE_CLASS;
  388.     
  389. public:
  390.     TPrintAdorner();
  391.     virtual ~TPrintAdorner();
  392.         // Destructor
  393.  
  394.     inline void IPrintAdorner()
  395.     { IAdorner(kPrintAdorner,kDontFreeOnDeletion); }    
  396.         // Initializes this adorner with ID kPrintAdorner and fFreeOnDeletion false
  397.  
  398.     //------------------------------------------------------------------------------------
  399.     // Standard signature support.
  400.     //------------------------------------------------------------------------------------
  401.  
  402.     virtual IDType GetStandardSignature();    // Override 
  403.         // Returns this class's standard signature.
  404.  
  405.     //------------------------------------------------------------------------------------
  406.     // rendering
  407.     //------------------------------------------------------------------------------------
  408.  
  409.     virtual void DoHighlightSelection(TView* itsView, 
  410.                                              const VRect& area,
  411.                                              HLState fromHL,
  412.                                              HLState toHL);    // Override
  413.         // calls itsView->DoHighlightSelection(fromHL, toHL)
  414. };
  415.  
  416.  
  417. //----------------------------------------------------------------------------------------
  418. // TResizeIconAdorner
  419. //----------------------------------------------------------------------------------------
  420.  
  421. class TResizeIconAdorner : public TAdorner
  422. {
  423.     MA_DECLARE_CLASS;
  424.     
  425. public:
  426.     TResizeIconAdorner();
  427.     virtual ~TResizeIconAdorner();
  428.         // Destructor
  429.  
  430.     inline void IResizeIconAdorner()
  431.     { IAdorner(kResizeIconAdorner,kDontFreeOnDeletion); }
  432.         // Initializes this adorner with ID kResizeIconAdorner and fFreeOnDeletion false
  433.  
  434.     //------------------------------------------------------------------------------------
  435.     // Standard signature support.
  436.     //------------------------------------------------------------------------------------
  437.  
  438.     virtual IDType GetStandardSignature();    // Overridee 
  439.         // Returns this class's standard signature.
  440.  
  441.     //------------------------------------------------------------------------------------
  442.     // rendering
  443.     //------------------------------------------------------------------------------------
  444.  
  445.     virtual void DoHighlightSelection(TView* itsView, 
  446.                                              const VRect& area,
  447.                                              HLState fromHL,
  448.                                              HLState toHL);    // Override
  449.         // calls ((TWindow*)itsView)->DrawResizeIcon
  450. };
  451.  
  452.  
  453. //----------------------------------------------------------------------------------------
  454. // TSelectionAdorner
  455. //----------------------------------------------------------------------------------------
  456.  
  457. class TSelectionAdorner : public TAdorner
  458. {
  459.     MA_DECLARE_CLASS;
  460.     
  461. public:
  462.     TSelectionAdorner();
  463.     virtual ~TSelectionAdorner();
  464.         // Destructor
  465.  
  466.     inline void ISelectionAdorner()
  467.     { IAdorner(kSelectionAdorner,kDontFreeOnDeletion); }
  468.         //  Initializes this adorner with ID kSelectionAdorner and fFreeOnDeletion false  
  469.  
  470.     //------------------------------------------------------------------------------------
  471.     // Standard signature support.
  472.     //------------------------------------------------------------------------------------
  473.  
  474.     virtual IDType GetStandardSignature();    // Override
  475.         // Returns this class's standard signature.
  476.  
  477.     //------------------------------------------------------------------------------------
  478.     // rendering
  479.     //------------------------------------------------------------------------------------
  480.  
  481.     virtual void DoHighlightSelection(TView* itsView, 
  482.                                              const VRect& area,
  483.                                              HLState fromHL,
  484.                                              HLState toHL);    // Override
  485.         //  calls itsView->DoHighlightSelection(fromHL, toHL)  
  486. };
  487.  
  488.  
  489. //----------------------------------------------------------------------------------------
  490. // TFrameAdorner
  491. //----------------------------------------------------------------------------------------
  492.  
  493. class TFrameAdorner : public TAdorner
  494. {
  495.     MA_DECLARE_CLASS;
  496.     
  497. public:
  498.     inline TFrameAdorner()
  499.     {}
  500.  
  501.     virtual ~TFrameAdorner();
  502.         // Destructor
  503.  
  504.     inline void IFrameAdorner(IDType itsID, Boolean freeOnDeletion)
  505.     { IAdorner(itsID,freeOnDeletion); }
  506.         // initializes this adorner with itsView 
  507.  
  508.     //------------------------------------------------------------------------------------
  509.     // Standard signature support.
  510.     //------------------------------------------------------------------------------------
  511.  
  512.     virtual IDType GetStandardSignature();    // Override 
  513.         // Returns this class's standard signature.
  514.  
  515.     //------------------------------------------------------------------------------------
  516.     // rendering
  517.     //------------------------------------------------------------------------------------
  518.  
  519.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  520.         // frames the extent of itsView 
  521. };
  522.  
  523. //----------------------------------------------------------------------------------------
  524. // TShadowedFrameAdorner
  525. //----------------------------------------------------------------------------------------
  526.  
  527. class TShadowedFrameAdorner : public TAdorner
  528. {
  529.     MA_DECLARE_CLASS;
  530.     
  531. public:
  532.     inline TShadowedFrameAdorner()
  533.     { }
  534.  
  535.     virtual ~TShadowedFrameAdorner();
  536.         // Destructor
  537.  
  538.     inline void IShadowedFrameAdorner(IDType itsID, Boolean freeOnDeletion)
  539.     { IAdorner(itsID,freeOnDeletion); }
  540.         // initializes this adorner with itsView 
  541.  
  542.     //------------------------------------------------------------------------------------
  543.     // Standard signature support.
  544.     //------------------------------------------------------------------------------------
  545.  
  546.     virtual IDType GetStandardSignature();    // Override 
  547.         // Returns this class's standard signature.
  548.  
  549.     //------------------------------------------------------------------------------------
  550.     // rendering
  551.     //------------------------------------------------------------------------------------
  552.  
  553.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  554.         // frames the extent of itsView 
  555. };
  556.  
  557. //----------------------------------------------------------------------------------------
  558. // TLineBottomAdorner
  559. //----------------------------------------------------------------------------------------
  560.  
  561. class TLineBottomAdorner : public TAdorner
  562. {
  563.     MA_DECLARE_CLASS;
  564.     
  565. public:
  566.     inline TLineBottomAdorner()
  567.     { }
  568.  
  569.     virtual ~TLineBottomAdorner();
  570.         // Destructor
  571.  
  572.     inline void ILineBottomAdorner(IDType itsID, Boolean freeOnDeletion)
  573.     { IAdorner(itsID,freeOnDeletion); }
  574.         // initializes this adorner with itsView 
  575.  
  576.     //------------------------------------------------------------------------------------
  577.     // Standard signature support.
  578.     //------------------------------------------------------------------------------------
  579.  
  580.     virtual IDType GetStandardSignature();    // Override 
  581.         // Returns this class's standard signature.
  582.  
  583.     //------------------------------------------------------------------------------------
  584.     // rendering
  585.     //------------------------------------------------------------------------------------
  586.  
  587.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  588.         // draws bottom line 
  589. };
  590.  
  591.  
  592. //----------------------------------------------------------------------------------------
  593. // TLineLeftAdorner
  594. //----------------------------------------------------------------------------------------
  595.  
  596. class TLineLeftAdorner : public TAdorner
  597. {
  598.     MA_DECLARE_CLASS;
  599.     
  600. public:
  601.     inline TLineLeftAdorner()
  602.     { }
  603.  
  604.     virtual ~TLineLeftAdorner();
  605.         // Destructor
  606.  
  607.     inline void ILineLeftAdorner(IDType itsID, Boolean freeOnDeletion)
  608.     { IAdorner(itsID,freeOnDeletion); }
  609.         // initializes this adorner with itsView 
  610.  
  611.     //------------------------------------------------------------------------------------
  612.     // Standard signature support.
  613.     //------------------------------------------------------------------------------------
  614.  
  615.     virtual IDType GetStandardSignature();    // Override
  616.         // Returns this class's standard signature.
  617.  
  618.     //------------------------------------------------------------------------------------
  619.     // rendering
  620.     //------------------------------------------------------------------------------------
  621.  
  622.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  623.         // draws left line 
  624. };
  625.  
  626.  
  627. //----------------------------------------------------------------------------------------
  628. // TLineRightAdorner
  629. //----------------------------------------------------------------------------------------
  630.  
  631. class TLineRightAdorner : public TAdorner
  632. {
  633.     MA_DECLARE_CLASS;
  634.     
  635. public:
  636.     inline TLineRightAdorner()
  637.     { }
  638.  
  639.     virtual ~TLineRightAdorner();
  640.         // Destructor
  641.  
  642.     inline void ILineRightAdorner(IDType itsID, Boolean freeOnDeletion)
  643.     { IAdorner(itsID,freeOnDeletion); }
  644.         // initializes this adorner with itsView 
  645.  
  646.     //------------------------------------------------------------------------------------
  647.     // Standard signature support.
  648.     //------------------------------------------------------------------------------------
  649.  
  650.     virtual IDType GetStandardSignature();    // Override
  651.         // Returns this class's standard signature.
  652.  
  653.     //------------------------------------------------------------------------------------
  654.     // rendering
  655.     //------------------------------------------------------------------------------------
  656.  
  657.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  658.         // draws right line 
  659. };
  660.  
  661.  
  662. //----------------------------------------------------------------------------------------
  663. // TLineTopAdorner
  664. //----------------------------------------------------------------------------------------
  665.  
  666. class TLineTopAdorner : public TAdorner
  667. {
  668.     MA_DECLARE_CLASS;
  669.     
  670. public:
  671.     inline TLineTopAdorner()
  672.     { }
  673.  
  674.     virtual ~TLineTopAdorner();
  675.         // Destructor
  676.  
  677.     inline void ILineTopAdorner(IDType itsID, Boolean freeOnDeletion)
  678.     { IAdorner(itsID,freeOnDeletion); }
  679.         // initializes this adorner with itsView 
  680.  
  681.     //------------------------------------------------------------------------------------
  682.     // Standard signature support.
  683.     //------------------------------------------------------------------------------------
  684.  
  685.     virtual IDType GetStandardSignature();    // Override 
  686.         // Returns this class's standard signature.
  687.  
  688.     //------------------------------------------------------------------------------------
  689.     // rendering
  690.     //------------------------------------------------------------------------------------
  691.  
  692.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  693.         // draws top line 
  694. };
  695.  
  696.  
  697. //----------------------------------------------------------------------------------------
  698. // TOvalAdorner
  699. //----------------------------------------------------------------------------------------
  700.  
  701. class TOvalAdorner : public TAdorner
  702. {
  703.     MA_DECLARE_CLASS;
  704.     
  705. public:
  706.     inline TOvalAdorner()
  707.     { }
  708.  
  709.     virtual ~TOvalAdorner();
  710.         // Destructor
  711.  
  712.     inline void IOvalAdorner(IDType itsID, Boolean freeOnDeletion)
  713.     { IAdorner(itsID,freeOnDeletion); }
  714.         // initializes this adorner with itsView 
  715.  
  716.     //------------------------------------------------------------------------------------
  717.     // Standard signature support.
  718.     //------------------------------------------------------------------------------------
  719.  
  720.     virtual IDType GetStandardSignature();    // Override
  721.         // Returns this class's standard signature.
  722.  
  723.     //------------------------------------------------------------------------------------
  724.     // rendering
  725.     //------------------------------------------------------------------------------------
  726.  
  727.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  728.         // draws oval adorner 
  729. };
  730.  
  731.  
  732. //----------------------------------------------------------------------------------------
  733. // TRRectAdorner
  734. //----------------------------------------------------------------------------------------
  735.  
  736. class TRRectAdorner : public TAdorner
  737. {
  738.     MA_DECLARE_CLASS;
  739.     
  740. public:
  741.     inline TRRectAdorner()
  742.     { }
  743.  
  744.     virtual ~TRRectAdorner();
  745.         // Destructor
  746.  
  747.     inline void IRRectAdorner(IDType itsID, Boolean freeOnDeletion)
  748.     { IAdorner(itsID,freeOnDeletion); }
  749.         // initializes this adorner with itsView 
  750.  
  751.     //------------------------------------------------------------------------------------
  752.     // Standard signature support.
  753.     //------------------------------------------------------------------------------------
  754.  
  755.     virtual IDType GetStandardSignature();    // Override 
  756.         // Returns this class's standard signature.
  757.  
  758.     //------------------------------------------------------------------------------------
  759.     // rendering
  760.     //------------------------------------------------------------------------------------
  761.  
  762.     virtual void Draw(TView* itsView, const VRect& area);    // Override
  763.         // adorns itsView with a round rectangle 
  764. };
  765.  
  766.  
  767. //----------------------------------------------------------------------------------------
  768. // AdornerElement
  769. //----------------------------------------------------------------------------------------
  770.  
  771. struct AdornerElement
  772. {
  773.     AdornPriority    priority;
  774.     TAdorner*         adorner;
  775.     
  776.     AdornerElement(AdornPriority itsPriority, TAdorner* itsAdorner);
  777.         // Constructor
  778. };
  779.  
  780. typedef AdornerElement* AdornerElementPtr;
  781.  
  782.  
  783. //----------------------------------------------------------------------------------------
  784. // AdornerElement inline function definitions.
  785. //----------------------------------------------------------------------------------------
  786.  
  787. inline AdornerElement::AdornerElement(AdornPriority itsPriority,
  788.                                      TAdorner*     itsAdorner)
  789. {
  790.     priority = itsPriority;
  791.     adorner = itsAdorner;
  792. }
  793.  
  794.  
  795. //----------------------------------------------------------------------------------------
  796. // TAdornerList: A list for keeping TAdorner objects ordered by priority 
  797. //----------------------------------------------------------------------------------------
  798.  
  799. class TAdornerList : public TSortedDynamicArray
  800. {
  801.     MA_DECLARE_CLASS;
  802.     
  803. public:
  804.     inline TAdornerList()
  805.     { }
  806.  
  807.     virtual ~TAdornerList();
  808.         // Destructor
  809.  
  810.     inline void IAdornerList()
  811.     { ISortedDynamicArray(0,sizeof(AdornerElement)); }
  812.         // Initialize the AdornerList procedurally. 
  813.  
  814.     //------------------------------------------------------------------------------------
  815.     // Stream I/O protocol support.
  816.     //------------------------------------------------------------------------------------
  817.  
  818.     virtual void ReadFrom(TStream* aStream);    // Override
  819.     
  820.     virtual void WriteTo(TStream* aStream);    // Override
  821.  
  822.  
  823.     virtual CompareResult CompareElements(void* Element1, void* Element2);    // Override
  824.         // Compares Two TAdorner objects based on their priority 
  825.  
  826.     void AddAdorner(TAdorner* itsAdorner, AdornPriority itsPriority);
  827.         // Add the adorner to the list 
  828.     
  829.     inline TAdorner* AdornerAt(ArrayIndex index) const
  830.     { return ((AdornerElementPtr) ComputeAddress(index))->adorner; }
  831.     
  832.     inline AdornPriority PriorityAt(ArrayIndex index) const
  833.     { return ((AdornerElementPtr) ComputeAddress(index))->priority; }
  834.         // Return the priority stored in the element record associated with this
  835.         // adorner.  Used when cloning a list of adorners.
  836.     
  837. };
  838.  
  839. //----------------------------------------------------------------------------------------
  840. // Global function declarations
  841. //----------------------------------------------------------------------------------------
  842.  
  843. extern void InitUAdorners();
  844.  
  845. extern TAdorner* NewStdAdorner(IDType signature,
  846.                                       const ClassName& className,
  847.                                       IDType itsID,
  848.                                       Boolean freeOnDeletion);
  849.  
  850.  
  851. //----------------------------------------------------------------------------------------
  852. // Global, preallocated, shared adorners:
  853. //----------------------------------------------------------------------------------------
  854.  
  855. extern TDimAdorner* gDimAdorner;                // Calls the view's Dim method  
  856.  
  857. extern TDrawAdorner* gDrawAdorner;                // Calls the view's Draw method  
  858.  
  859. extern TEraseAdorner* gEraseAdorner;            // Erases the area passed in the DoDraw
  860.                                                 // method
  861.  
  862. extern THiliteAdorner* gHiliteAdorner;            // Calls the view's Hilite method  
  863.  
  864. extern TPrintAdorner* gPrintAdorner;            // Calls the view's DoDrawPrintFeedback
  865.                                                 // method
  866.  
  867. extern TResizeIconAdorner* gResizeIconAdorner;    // Calls the TWindow's DrawResizeIcon
  868.                                                 // method
  869.  
  870. extern TSelectionAdorner* gSelectionAdorner;    // Calls the view's DoHighlightSelection
  871.                                                 // method
  872.  
  873.  
  874. //----------------------------------------------------------------------------------------
  875. // Convenient RGB color settings 
  876. //----------------------------------------------------------------------------------------
  877.  
  878. extern CRGBColor gRGBVeryLtGray;                // Greyscale very light gray 
  879.  
  880. extern CRGBColor gRGBLtGray;                    // Greyscale light gray 
  881.  
  882. extern CRGBColor gRGBGray;                        // Greyscale regular gray 
  883.  
  884. extern CRGBColor gRGBDkGray;                    // Greyscale dark gray 
  885.  
  886. #endif
  887.  
  888.  
  889.